package P3.T07;

import java.util.ArrayList;
import java.util.List;

public class T07 {
    public static int sum(List<? extends getInt> lsts){
        int s=0;
        for(int i=0;i<lsts.size();i++)s+=lsts.get(i).getData();
        return s;
    }

    public static void main(String[] args) {
        List<Cat> cats=new ArrayList<>();
        cats.add(new Cat(1));
        cats.add(new Cat(3));
        cats.add(new Cat(4));
        cats.add(new Cat(5));
        System.out.println(sum(cats));
    }
}
interface getInt{
    int getData();
}
class Cat implements getInt{
    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Cat(int age) {
        this.age = age;
    }

    @Override
    public int getData() {
        return age;
    }
}